package com.ruoyi.chat.domain;

import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.List;

/**
 * 聊天助手对象 chat
 * 
 * @author ruoyi
 * @date 2025-03-26
 */
public class Chat extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 聊天助手ID */
    private Long id;

    /** ragFlow助手的id */
    @Excel(name = "ragFlow助手的id")
    private String ragChatId;

    /** 名称 */
    @Excel(name = "名称")
    private String name;

    private Long userId;

    private List<ChatDataset> chatDatasets;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;

    public Chat() {
    }

    public Chat(Long id) {
        this.id = id;
    }

    public Long[] getChatDataIds() {
        if (CollectionUtils.isEmpty(this.chatDatasets)) {
            return new Long[]{};
        }
        return this.chatDatasets.stream().map(ChatDataset::getDatasetId).distinct().toArray(Long[]::new);
    }

    public void setUserId(Long userId)
    {
        this.userId = userId;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    public void setRagChatId(String ragChatId)
    {
        this.ragChatId = ragChatId;
    }

    public Long getId() {
        return id;
    }

    public String getRagChatId() {
        return ragChatId;
    }

    public String getName() {
        return name;
    }

    public Long getUserId() {
        return userId;
    }

    public List<ChatDataset> getChatDatasets() {
        return chatDatasets;
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public void setChatDatasets(List<ChatDataset> chatDatasets)
    {
        this.chatDatasets = chatDatasets;
    }

    public void setDelFlag(String delFlag)
    {
        this.delFlag = delFlag;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("ragChatId", getRagChatId())
            .append("name", getName())
            .append("chatDatasets", getChatDatasets())
            .append("delFlag", getDelFlag())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}
